//
//  SHEBaseViewController.m
//  SHEPuzzleFigure
//
//  Created by SW mini on 2019/11/25.
//  Copyright © 2019 Figure. All rights reserved.
//

#import "SHEBaseViewController.h"
#import "SHEStrokeLabel.h"

@interface SHEBaseViewController ()
{
    SHEStrokeLabel *strokeLabe;
}
@end

@implementation SHEBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];

}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBarHidden = YES;
}

- (void)addBg{
    
    UIImageView *imgV = [[UIImageView alloc] init];
    [self.view addSubview:imgV];
    [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.left.right.equalTo(@0);
        make.width.equalTo(@(SHEWidth)).priorityLow();
        make.height.equalTo(@(SHEHeight)).priorityLow();
    }];
    imgV.image = [UIImage imageNamed:@"di.jpg"];
    imgV.contentMode = UIViewContentModeScaleToFill;
}
//设置标题
-(void)setTitleView:(NSString *)title{
    strokeLabe = [[SHEStrokeLabel alloc] init];
    [self.view addSubview:strokeLabe];
    
    [strokeLabe mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(SHENavStatues));
        make.left.equalTo(@SHE_buttonW);
        make.right.equalTo(@-SHE_buttonW);
        make.height.equalTo(@(44));
    }];

    
    strokeLabe.font = [UIFont fontWithName:@"FZY4K--GBK1-0" size:30.0 ];
    strokeLabe.text = title;
    strokeLabe.textAlignment = NSTextAlignmentCenter;
    CGAffineTransform matrix = CGAffineTransformMake(1, 0, tanf(-15 * (CGFloat)M_PI / 180), 1, 0, 0);
    strokeLabe.transform = matrix;
}

//设置返回按钮
-(void)createBackBtn{
    UIImage *imgBack = [UIImage imageNamed:@"fanhui"];
    UIButton *_backBtn =[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:_backBtn];
    [_backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(SHENavStatues));
        make.left.equalTo(@5);
        make.width.equalTo(@SHE_buttonW);
        make.height.equalTo(@SHE_buttonH);
    }];
    [_backBtn setImage:imgBack forState:UIControlStateNormal];
    [_backBtn addTarget:self action:@selector(goBack:) forControlEvents:UIControlEventTouchUpInside];
    _backBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
    _backBtn.imageEdgeInsets = UIEdgeInsetsMake(5, 0, 5, 0);
}

-(void)goBack:(id)sender{
    if (self.navigationController.presentingViewController && [self.navigationController.viewControllers count] == 1) {
        [self.navigationController dismissViewControllerAnimated:YES completion:nil];
    }else {
        [self.navigationController popViewControllerAnimated:YES];
    }
}

- (void)PromptInformation:(NSString *)xinxi{
    [EasyTextView showText:xinxi config:^EasyTextConfig *{
        return [EasyTextConfig shared].setBgColor([UIColor lightGrayColor]).setShadowColor([UIColor clearColor]).setStatusType(TextStatusTypeMidden);
    }];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
